package algotithm.interview.顺丰科技.test1;

import java.io.*;

/**
 * @author zhouyanxiang
 * @Date 2021-03-2021/3/10-19:21
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

        String[] arr1 = reader.readLine().split(" ");
        int n = Integer.parseInt(arr1[0]);
        int q = Integer.parseInt(arr1[1]);
        String[] arr2 = reader.readLine().split(" ");
        int[] a = new int[n+2];
        long[] pre = new long[n+2];
        for (int i = 1; i <= n; i++) {
            a[i] = Integer.parseInt(arr2[i-1]);
        }
        for (int i = 1; i <= n+1; i++) {
            pre[i] = pre[i-1] + a[i];
        }

        int p = q;
        while (p-- > 0) {
            String[] arr = reader.readLine().split(" ");
            int L = Integer.parseInt(arr[0]);
            int R = Integer.parseInt(arr[1]);
            int x = (R + 1 - L - 2);
            if (R + 1 - L  < 3) {
                writer.write("NoScore" + "\n");
            } else {
                int max = Integer.MIN_VALUE;
                int min = Integer.MAX_VALUE;
                for (int i = L; i <= R; i++) {
                  if (a[i] > max) {
                      max = a[i];
                  }
                  if (a[i] < min) {
                      min = a[i];
                  }
                }
                long sum = pre[R] - pre[L-1] - max - min;
                long res = sum / x;
                writer.write(res + "\n");
            }
        }
        writer.flush();
        writer.close();
        reader.close();

    }

}
